﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>加签</title>
    <!--
    1, 退回界面。
    2，需要 FK_Flow, FK_Node,WorkID, FID.
    3, 调用方法 HuiQian.htm?FK_Flow=001&FK_Node=103&WorkID=232&FID=23
    -->
    
    <link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/components-rounded.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
    <link href="../Scripts/bootstrap/css/themes/default/style.min.css" rel="stylesheet" />
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>
    <script type="text/javascript" src="../Scripts/QueryString.js"></script>

    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
    <script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <link href="../../DataUser/Style/Table0.css" rel="Stylesheet" />
    <!-- 导入配置文件. -->
    <script type="text/javascript" src="../Scripts/config.js"></script>
    <script type="text/javascript" src="../Comm/Gener.js"></script>

    <style type="text/css">
        body
        {
            background: transparent;
        }
        body div
        {
            text-align: left;
        }
        #Message
        {
            width: 100%;
        }
        
        #SelectEmp
        {
            position: relative;
            width: 400px;
            border-top: 0;
            display: none;
            margin-top: -7px; /*border: solid 2px #3175af;*/
        }
        
        .item
        {
            padding: 3px 5px;
            cursor: pointer;
            float: left;
            width: 190px;
            line-height: 20px;
            display: inline-block;
            background-color: #F7F7F7;
        }
        
        #next
        {
            float: left;
            position: relative;
            width: 600px;
        }
        
        .addbg
        {
            background: #CFCFCF;
        }
    </style>
    <script type="text/javascript">
        var param = {};
        $(function () {

            Help();

            //初始化页面移交页面
            param = {
                FK_Node: GetQueryString('FK_Node'),
                WorkID: GetQueryString('WorkID'),
                FID: GetQueryString('FID'),
                Message: GetQueryString('Info'),
                FK_Flow: GetQueryString("FK_Flow")
            };

            $('#Msg').val(param.Message);

            //初始化人员选择窗口
            var selectEmpModalHtml = '<div class="modal fade" id="selectEmpsModal">' +
               '<div class="modal-dialog">'
                   + '<div class="modal-content" style="border-radius:0px;width:700px;">'
                      + '<div class="modal-header">'
                          + '<button type="button" class="close" style="color:white;opacity:1;" data-dismiss="modal" aria-hidden="true">&times;</button>'
                           + '<h4 class="modal-title">选择加签人</h4>'
                       + '</div>'
                       + '<div class="modal-body">'
                           + '<iframe style="width:100%;border:0px;height:400px;" id="iframeSelectEmpsForm" name="iframeSelectEmpsForm"></iframe>'
                       + '</div>'
                   + '</div><!-- /.modal-content -->'
               + '</div><!-- /.modal-dialog -->'
           + '</div>';

            $('body').append($(selectEmpModalHtml));
            var dept = getQueryStringByNameFromUrl("?" + $.cookie('CCS'), "FK_Dept");
            if (dept == null || dept == '' || dept == undefined) {
                dept = $.cookie('FK_Dept');
            }
            if (dept == undefined) {
                var u = new WebUser();
                dept = u.FK_Dept;
            }
            var url = "SelectEmps.htm?FK_Dept=" + dept + "&FK_Node=" + GetQueryString("FK_Node") + "&s=" + Math.random();
            //  url = url.replace('101', '10102');
            url = url.replace('=101&', '=10102&');

            $('#iframeSelectEmpsForm').attr('src', url);
            $('#Btn_SelectEmps').bind('click', function () { $('#selectEmpsModal').modal().show(); });
            //$("section").show();
            $(".Msg").hide();


            //执行数据初始化工作.
            var hand = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            hand.AddUrlData();
            var data = hand.DoMethodReturnString("HuiQian_Init");
            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }


            var gwls = JSON.parse(data);

        });



        //确定后，就弹出选择到达节点，选择接受人，填写审核意见窗口.
        function SaveAndClose() {

            var toEmp = $("#TB_No").val();
            if (toEmp == null || toEmp == "") {
                alert("加签人不能为空");
                return;
            }
            var note = $("#TB_Tag2").val().trim();
            if (note == null || note == "") {
                alert("加签原因不能为空");
                return;
            }
            
            var model = $("input[name='RB']:checked").val();
            var toNode = GetQueryString("ToNode");
            if (toNode == undefined || toNode == "undefined")
                toNode = "0";

            $("#Btn_JiaQian").attr("disabled", "disabled");
            $("#Btn_SelectEmps").attr("disabled", "disabled");


            //执行数据初始化工作.
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
            handler.AddUrlData();
            handler.AddPara("ToEmp", toEmp);
            handler.AddPara("Note", note);
            handler.AddPara("Model", model);
            var data = handler.DoMethodReturnString("Askfor");

            if (data.indexOf('err@') == 0) {
                alert(data);
                $("#Btn_JiaQian").attr("disabled", "");
                $("#Btn_SelectEmps").attr("disabled", "");
                return;
            }

            if (data.indexOf('url@') == 0) {
                data = data.replace('url@', '');
                SetHref(data);
                return;
            }


            alert(data);
            window.parent.close();
          
            return;
        }


        //设置选中的人员
        function selectEmpsWindowClose(data) {

            $('#selectEmpsModal').modal('hide');
            if (data == '取消') {
                return;
            }
            $('#TB_No').val(frames["iframeSelectEmpsForm"].window.returnVal.No);//赋值no，传后台
            $('#TB_Emps').val(frames["iframeSelectEmpsForm"].window.returnVal.Name);
        }


        $(function () {

            //人员选择
            $("#TB_Emps").bind('input propertychange', function () {


                if ($("#TB_Emps").val() == null || $("#TB_Emps").val() == "") {
                    $("#SelectEmp").hide().html("");
                    return;
                }

                //执行数据初始化工作.
                var hand = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
                hand.AddUrlData();
                hand.AddPara("TB_Emps", $("#TB_Emps").val());
                var data = hand.DoMethodReturnString("HuiQian_SelectEmps");
                if (data.indexOf('err@') == 0) {
                    alert(data);
                    return;
                }

                data = JSON.parse(data);
                //$("#SelectEmp").hide().html("");
                var html = "";
                for (var i = 0; i < data.length; i++) {
                    html = html + "<div class='item' onclick='getCon(\"" + data[i].Name+"/"+data[i].No + "\");' onmouseenter='getFocus(this)'>" + data[i].Name + "</div>";
                }
                $("#SelectEmp").show().html(html);

            });
        });


        //鼠标事件
        function getFocus(obj) {
            $(".item").removeClass("addbg");
            $(obj).addClass("addbg");
        }

        //选择下拉数据
        function getCon(Name) {

            var name = Name.split("/");
            $("#TB_No").val(name[2]);
            $("#TB_Emps").val(name[0]);

            $("#SelectEmp").hide().html("");
        }

        function Help() {
            $("#HelpInfo").toggle();
        }
    </script>
</head>
<body >
    <div style="width: 98%;margin-left:20px">
    <br />
    <div>
        <div id="labInfo">
            选择加签人:
            <input type="hidden" id="TB_No" />
            <input type="text" id="TB_Emps"  title="查张三,您可输入: zs或zhangs或zhangsan"
                placeholder="查张三,您可输入:zs或zhangs或zhangsan"  name="TB_Emps" value='' style="width: 300px;" />
            <input type="button" id="Btn_SelectEmps" value='选择加签人' /><a href="javascript:Help()">帮助</a>
            <div id="SelectEmp">
            </div>
            <br />
            <div id="Div1">
                <th colspan="2">
                    加签原因说明:
                </th>
                <tr>
                <td colspan="2">
                    <textarea id="TB_Tag2" name="TB_Tag2" style="width: 98%; " rows="4">
                    </textarea>
                
                </td>
                </tr>
            </div>
            <div id="Div2">
                <tr>
                    <th colspan="2">
                        处理方式:&nbsp;&nbsp;
                    </th>
                <tr>
                <tr>
                    <td colspan="2">
                     <input type="radio" value="0" id="RB_0"  name="RB" checked="checked"/><label for="RB_0" >对方加签后，直接发送到下一步</label>
               
                    </td>
                    <td colspan="2">
                         <input type="radio" value="1" id="RB_1"  name="RB" /><label for="RB_1" >对方加签后转发给我，由我发送到下一步</label> 
                    </td>
                </tr>
            </div>
           
            <div id="next">
                <input type="button" id="Btn_JiaQian" value="提交" onclick="SaveAndClose();" />
                <!--<img src="../Img/Multiplayer.png"  onclick="SaveAndClose();"  style="width:27px;"/>-->
                <div id="HelpInfo" style="">
                    <ul>
                         
                    </ul>
                </div>
            </div>
            
        </div>
        <div class="Msg" style="float: left;">
            <img src='../Img/loading.gif' alt="" />页面数据正在加载中，请稍候......</div>
    </div>
    <br />
    </div>

</body>
</html>
